package com.tanhua.manager.service;

import com.tanhua.domain.vo.AnalysisSummaryVo;
import com.tanhua.dubbo.api.db.AnalysisByDayApi;
import org.apache.dubbo.config.annotation.Reference;
import org.joda.time.DateTime;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Service;

@Service
public class AnalysisByDayService {

    @Reference
    private AnalysisByDayApi analysisByDayApi;

    public void analysisByDay(String todayStr) {
        analysisByDayApi.analysisByDay(todayStr);

    }

    public ResponseEntity summary() {

        String todayStr = new DateTime().toString("yyyy-MM-dd");
        AnalysisSummaryVo analysisSummaryVo =  analysisByDayApi.summary(todayStr);

        return ResponseEntity.ok(analysisSummaryVo);

    }
}
